package fun.xinnix.design.chain;

/**
 * @author Administrator
 */
public class ThirdChainHandler extends ChainHandler {
    @Override
    public void handler() {
        if (approval()) {
            System.err.println("3级审批通过");
            if (this.nextHandler != null) {
                System.err.println("进入4级审批");
                this.nextHandler.handler();
            } else {
                System.err.println("审批结束");
            }
        } else {
            System.err.println("3级审批拒绝");
        }
    }

    private boolean approval() {
        // ................
        return (int) (Math.random() * 5) < 4;
    }
}
